﻿<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport"
          content="width=device-width, initial-scale=1, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！-->
    <title>学生惠后台管理系统</title>
    <link rel="stylesheet" href="/App/Admin/public/css/bootstrap.min.css"/>
    <link rel="stylesheet" href="/App/Admin/public/css/style.css"/>
     <script type="text/javascript" charset="utf-8" src="/App/Admin/public/js/kindeditor/kindeditor.js"></script>
    <script type="text/javascript" charset="utf-8" src="/App/Admin/public/js/kindeditor/lang/zh_CN.js"></script>
</head>
<body>
<div class="mainBody">
    <include file="Public:left"/>
    <div class="main">
       <include file="Public:top"/>

        <div class="subNav">
            <span class="text"><i class="iconFont">&#xe600;</i>公告消息 - 编辑</span>
        </div>

        <div class="indexBox">
            <div class="con-det">
                <div class="row">
                    <div class="col-md-12">
                        <form id="commentForm">
                               <input type="hidden" class="updateid" value="{$dataInfo.id}">
                            <table class="formTable editForm">
                                <tr>
                                    <td class="noBor" valign="top">标题</td>
                                    <td class="noBor" valign="top"><input type="text"  id="title" value="{$dataInfo.title}"  class="inp form-control"></td>
                                    <td class="noBor"></td>
                                    <td class="noBor" valign="top">文章类型</td>
                                    <td class="noBor" valign="top">
                                        <select  id="colid" class="inp form-control">
                                           <foreach name="typeArr" item="val">
					     <option value="{$key}"  <if condition="$key eq $dataInfo['type_id']"> selected </if> >{$val}</option>
					   </foreach>
                                         </select> 
                                    </td>
                                </tr>
                                <tr>
                                    <td valign="top">内容</td>
                                    <td valign="top" colspan="4">
                                         <textarea id="myEditor" class="content"  type="text/plain" name="contents" style="min-width:100px;width:1000px;height:500px;line-height:20px">{$dataInfo.content}</textarea>
                                    </td>
                                      <script type="text/javascript">
                                        KindEditor.ready(function(K) {
                                                   window.editor = K.create('#myEditor');
                                         });
                                        KindEditor.ready(function(K) {  
                                           editor = K.create('textarea[name="contents"]',options);  

                                       });  
  
                                     </script>
                                    
                                    
                                </tr>
                                <tr>
                                    <td class="textAliRi" colspan="5">
                                        <button class="btn btn-primary blue" type="submit">发布</button>
                                        <a href="{:U("News/index")}" class="btn btn-default" type="button">返回</a>
                                    </td>
                                </tr>
                            </table>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script type="text/javascript" src="/App/Admin/public/js/jquery-2.1.1.min.js"></script>
<script type="text/javascript" src="/App/Admin/public/js/bootstrap.min.js"></script>
<script type="text/javascript" src="/App/Admin/public/js/ueditor.config.js"></script>
<script type="text/javascript" src="/App/Admin/public/js/ueditor.all.min.js"></script>
<script type="text/javascript" src="/App/Admin/public/js/zh-cn.js"></script>
<script type="text/javascript" src="/App/Admin/public/js/public.js"></script>


<script type="text/javascript">
	$('.btn-primary').on('click',function(){
	
	var title = $('#title').val();
        var colid=$('#colid').val();
           editor.sync(); 
	   var content=$('#myEditor').val();
	var updateid=$('.updateid').val();

	
    if( title == ''){
	    alert("标题不能为空");
		return false;
	    }
    

     $.post('{:U("News/saveEdit")}',{title:title,colid:colid,content:content,updateid:updateid},function(data){
		  if(data.status==100){
		        window.location='{:U("News/index")}';
		   }else{
			alert(data.info);
		  }
	  })
		
});
	</script>

</body>
</html>








